﻿<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
    xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>Create Schedule Framework</Title>
      <Author>Teacher彭</Author>
      <Description>创建Schedule代码框架</Description>
      <Shortcut>sche</Shortcut>
    </Header>
    <Snippet>
      <Declarations>
        <Literal>
          <ID>Key</ID>
          <ToolTip>Schedule Key</ToolTip>
          <Default>ScheduleName</Default>
        </Literal>
        <Literal>
          <ID>Description</ID>
          <ToolTip>Schedule Description</ToolTip>
          <Default>计划任务说明</Default>
        </Literal>
      </Declarations>
      <Code Language="CSharp">
        <![CDATA[using PengSW.Schedule;
using PengSW.SqlServerTools;
using PengSW.XmlHelper;
using SocialMedia.Core;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;
using System.Linq;
using System.Xml.Linq;
using static PengSW.JsonHelper.Serializer;
using static PengSW.RuntimeLog.RL;
using static PengSW.WebHelper.Downloader;
using static SocialMedia.DataCenter.Model.MainModel;

namespace SocialMedia.DataCenter.Schedule
{
    public class $Key$ : ScheduleBase
    {
        public $Key$(XElement aXElement) : base(aXElement)
        {
        }

        public $Key$()
        {
        }

        public override string Description => "$Description$";

        protected override void _OnDispatch()
        {
            L("$Key$ dispatching...");
            throw new NotImplementedException();
            using (SocialMediaDataContext aDataContext = CreateSocialMediaDataContext())
            {

                aDataContext.SubmitChanges();
            }
        }
    }
    public class $Key$Factory : IScheduleFactory
    {
        public string Description => "$Description$";

        public ISchedule CreateSchedule()
        {
            return new $Key$();
        }

        public ISchedule CreateSchedule(XElement aXElement)
        {
            return new $Key$(aXElement);
        }

        public bool IsCreatable(XElement aXElement) => aXElement?.GetAttributeValue("Type", null) == typeof($Key$).Name;
    }
}
]]>
      </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
